package com.wb.spring.boot.autoconfigure.register;

import org.springframework.data.redis.connection.Message;

/**
 *
 */
public class ConsulSubscriber {

    private ConsulRegister consulRegister;

    //    @Override
    public void onMessage(Message message, byte[] pattern) {
        if ("\"register\"".equals(new String(message.getBody())) || "\"unregister\"".equals(new String(message.getBody()))) {
            consulRegister.refreshServer();
        }
    }

    public ConsulSubscriber(ConsulRegister consulRegister) {
        super();
        this.consulRegister = consulRegister;
    }
}
